package beans;

import java.sql.SQLException;
import java.util.ArrayList;

import DAO.ServicoDAO;

public class Servicos {
	
	//ATRIBUTOS
	int cdServico;
	int cdPrestador;
	String servicoNome  = new String();
	String servicoPreco = new String();
	
	//METODOS - GETs e SETs
	public int getCdServico() {
		return cdServico;
	}
	public void setCdServico(int cdServico) {
		this.cdServico = cdServico;
	}
	public int getCdPrestador() {
		return cdPrestador;
	}
	public void setCdPrestador(int cdPrestador) {
		this.cdPrestador = cdPrestador;
	}
	public String getServicoNome() {
		return servicoNome;
	}
	public void setServicoNome(String servicoNome) {
		this.servicoNome = servicoNome;
	}
	public String getServicoPreco() {
		return servicoPreco;
	}
	public void setServicoPreco(String servicoPreco) {
		this.servicoPreco = servicoPreco;
	}
	
	//CADASTRAR SERVICO
	public void cadastrarServico(){
		ServicoDAO.getServicoDAO().inserirServico(this.cdPrestador, this.servicoNome, this.servicoPreco);
	}
	
	//DELETAR SERVICO
	public void deletarServico(){
		ServicoDAO.getServicoDAO().deletarServico(this.cdServico);
	}
	
	//ATUALIZAR SERVICO
	public void atualizarServico(){
		ServicoDAO.getServicoDAO().atualizarServico(this.cdPrestador, this.servicoNome, this.servicoPreco, this.cdServico);
	}
	
	//BUSCAR LISTA DE SERVICOS
	public ArrayList<Servicos> buscarListaServicos() throws SQLException{
		ArrayList<Servicos> servicos = new ArrayList<Servicos>();
		servicos = ServicoDAO.getServicoDAO().buscarListaServ(this.cdPrestador);
		return servicos;
	}
}
